package sjs.util;

import sjs.bean.DelTest;
import sjs.bean.User;
import sjs.service.PMF;

public class Ajax {
	public Ajax(){}
	
	public String AjaxTest(String s){
		System.out.println(s);
		return "aaa111bbb222";
	}
	public String deleteUser(Long id){
		try{
			System.out.println(id);
			DelTest t=(DelTest)PMF.findById(DelTest.class, id);
			PMF.delete(t);
			return "success";
		}catch (javax.jdo.JDOUserException e) {
			return "err: "+e.getMessage();
			// TODO: handle exception javax.jdo.JDOObjectNotFoundException
		}catch (javax.jdo.JDOObjectNotFoundException e) {
			return "err: "+e.getMessage();
			// TODO: handle exception 
		}catch (Exception e) {
			return "err: "+e.getMessage();
			// TODO: handle exception
		}
	}
	public String addUser(String a){
		try{
			DelTest t=new DelTest();
			t.setA(a);
			PMF.save(t);
			return "success";
		}catch (Exception e) {
			return "err: "+e.getMessage();
			// TODO: handle exception
		}
	}
	
}	
